<template>
  <div id="putlandlist"> 


          <el-table :data="datalist" style="width: 100%" :height="dtheight" :header-cell-style="{background:'#4F81BC',color:'white'}"
           :row-class-name="tableRowClassName"  :border="true">

                <el-table-column label="注册时间"  align='center'  width="200">                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.register_time }}</span>
                    </template>
                </el-table-column>

                <el-table-column label="收放类别"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span v-if="scope.row.able_distribute == 1">放</span>
                        <span v-if="scope.row.super_account == 1">收</span>
                    </template>
                </el-table-column>

                <el-table-column label="帐号"  align='center'  width="180">                   
                    <template slot-scope="scope">                   
                         <span style="display: flex;align-items: center;justify-content: center;">
                                 {{ scope.row.telphone }}
                                <img src="@/assets/images/a9.png" style="width:18px;height:20px;margin-left:5px;" @click="goinforpersonal(scope.row,scope.row.telphone)"/>
                            </span>
                    </template>
                </el-table-column>
                <el-table-column label="用户名"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.nickname }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="运营中心"  align='center' width="200px">                   
                    <template slot-scope="scope">                       
                        <span v-if="scope.row.center">{{ scope.row.center.name }}</span>
                         <span v-else>暂无</span>
                    </template>
                </el-table-column>
                 <el-table-column label="收放数据"  align='center'  >                   
                    <template slot-scope="scope">                   
                       <span @click="see_data(scope.row)"><i class="el-icon-view el-icon--right"></i></span>
                    </template>
                </el-table-column>
                    
 
                 <el-table-column label="操作" align='center' width="270px"  fixed="right">
                    <template slot-scope="scope">
                        <span v-if="scope.row.able_distribute == 1">
                           <el-button size="mini"  type="primary" class="button_class1"  plain @click="go_but_1(scope.row)">分配</el-button>
                           <el-button size="mini"  type="primary" class="button_class2"  plain  @click="go_but_2(scope.row)">分配详情</el-button> 
                         </span>
                         <el-button size="mini"  type="primary"  class="button_class1" plain @click="set_but(scope.row)">密码设置</el-button> 
                    </template>
                </el-table-column>
  
            </el-table>  


        <!-- 中心数据 -->
        <el-dialog title="中心数据" :visible.sync="see_mtk"  width="550px">
            <div style="width:100%;"> 

             <el-table :data="seelist" style="width: 100%" height="400px" :header-cell-style="{background:'#4F81BC',color:'white'}"
           :row-class-name="tableRowClassName"  :border="true">
                
                 <el-table-column label="名称"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.title }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="数量(收)"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.in_all_count }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="数量(放)"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.out_all_count }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="价值(收)"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.in_all_price }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="价值(放)"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.out_all_price }}</span>
                    </template>
                </el-table-column>
               

            </el-table> 


            </div> 
        </el-dialog>


        <el-dialog title="密码设置" :visible.sync="paw_mtk"  width="300px" >    
            <div style="display: flex;justify-content: space-around;padding:30px 0px;">
                <el-button size="mini"  type="primary"  plain class="button_class1"   @click="xg_mm_but()">重置密码</el-button>
                <el-button size="mini"  type="primary"  plain class="button_class2"  @click="xg_ej_but()">二级密码</el-button>
            </div>
   </el-dialog>



   </div>
</template>

<script>

export default {
   name: 'putlandlist',
   props:{
      datalist:{  
        //type:Array,
       default:()=>[]
     },
  },
  data () {
    return {
        dtheight:'500',  //窗口高度
        seelist:[],
        see_mtk:false,
        uid:'',
        paw_mtk:false,
    }
  },
   components:{

  },
  created(){
     this.dtheight = window.innerHeight - 365
      
  },
  mounted (){
    
  },
  methods: {
   
   go_but_1(row){
       this.$router.push({
          path: '/index/distribution',
          query: {
            name:row.telphone,
            id:row.uid
          }
        })
    },
    go_but_2(row){
       this.$router.push({
          path: '/index/records',
          query: {
            name:row.telphone,
            id:row.uid
          }
        })
    },
    see_data(row){
          this.uid = row.uid
         this.see_mtk = true
         this.see_fun()
    },
    see_fun(){
      this.post("/member_special/sfData", {
              uid:this.uid
	        }).then(res => {
            this.seelist = res.result
            console.log(this.seelist)
         })
    },
     set_but(row){
         this.uid = row.uid
         this.paw_mtk = true
     },
    xg_mm_but(){
   
      


       this.$confirm('此用户将重置登录密码, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
            
            this.post("/member/resetLoginPwd", {
            uid:this.uid
	          }).then(res => {

              if(res.error_code == 0){
                  this.open1(res.result,'success')  //提示框
                  this.paw_mtk = false
              }else {
                  this.open1(res.message,'warning')
              }
       

            })
             
        }).catch(() => {
              // this.$message({
              //   type: 'info',
              //   message: '已取消重置密码'
              // });          
        });

     
    },
    xg_ej_but(){
   
       this.$confirm('此用户将重置二级密码, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
            
            this.post("/member/resetSafePwd", {
            uid:this.uid
	          }).then(res => {

              if(res.error_code == 0){
                  this.open1(res.result,'success')  //提示框
                  this.paw_mtk = false
              }else {
                  this.open1(res.message,'warning')
              }
       

            })
             
        }).catch(() => {
              // this.$message({
              //   type: 'info',
              //   message: '已取消重置密码'
              // });          
        });

     
    },
    goinforpersonal(row,telphone){      
        this.$router.push({
          path: '/index/inforpersonal',
          query: {
            name:telphone,
          }
        })
    },


  }
}
</script>


<style scoped>
.el-dialog__wrapper>>>.el-dialog__body{
    padding:0px 10px 10px 10px;
}

</style>